﻿@using TSites.Administrator.Extensions
@model TSites.Administrator.Models.LogonViewModel
@{
    ViewBag.Title = "Logon";
}

<link href="@Url.Stylesheet("login.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Script("jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Script("jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Index", "Logon", FormMethod.Post))
{
    <div class="container_16">     
        <div class="TS_AM_Group">
          <div class="TS_AM_Radius_Middle">
              <div class="TS_AM_Login">
                 <fieldset>
		            @Html.AntiForgeryToken("LogonPost")
		            <legend>Welcome to ThreeSites Administrator</legend>
	                    <div class="TS_AM_InLogin">
    	                    <p>   
                            <div class="TS_AM_Lable">                       
                              @Html.LabelFor(m => m.Username)     </div>                                            
			                  @Html.TextBoxFor(m => m.Username, new { style = "width:175px" })
			                  @Html.ValidationMessageFor(m => m.Username)                           
                            </p>

		                    <p>
                               <div class="TS_AM_Lable">
			                    @Html.LabelFor(m => m.Password)
                                </div>                                
			                    @Html.PasswordFor(m => m.Password, new { style = "width:175px" })
			                    @Html.ValidationMessageFor(m => m.Password)                              
		                    </p>

							<p>
                               <div class="TS_AM_Lable">
			                    @Html.LabelFor(m => m.Captcha)
                                </div>
			                    <div id='divCaptcha'>
								</div>
								<button id="btnRefresh" type="button" value="Refresh">Refresh</button>
			                    @Html.EditorFor(m => m.Captcha)
								@Html.ValidationMessageFor(m => m.Captcha)
		                    </p>

		                    <p>
			                    @Html.CheckBoxFor(m => m.RememberMe)
			                    @Html.LabelFor(m => m.RememberMe)
		                    </p>                    
		                     <input type="submit" value="Log On"  class="TS_AM_Button"/>                            
                          </div>
                          <div class="TS_AM_Logo">
                           <img src="../../Content/themes/base/images/App-login-manager-icon.png" />
                          </div>
                        
	          </fieldset>
               </div>
           </div>
        </div>

        <div class="TS_AM_Radius_Top">
              <div class="radius3"></div>
              <div class="radius2"></div>
              <div class="radius1"></div>
          </div>
          
	<div class="TS_Copyright">
		Copyright © 2012 by ThreeSites Team
	</div>
    <br clear="all">
    </div>
}

<script type="text/javascript">
    $(document).ready(function () {
        btnRefresh_click();
        $('#btnRefresh').click(btnRefresh_click);
    });

    function btnRefresh_click() {
        $.post('Logon/CaptchaImage', function (data) {
        	$('#divCaptcha').html(data).show();
        });
    }
</script>